// pages/play/play.js
const {getPlayUrl} = require("../../models/play")
const audio = wx.getBackgroundAudioManager();
Page({
  data: {
    // 定义音乐播放的状态
    imgUrl:"",
    play:""
  },
  onLoad: async function (options) {
    let res = await getPlayUrl(options.id)
    var playUrl = res.data.data[0].url;
    wx.setStorageSync('playUrl', playUrl)
    let playUrlOn = wx.getStorageSync('playUrl')
    audio.title="niupi";
    audio.src= playUrlOn

    // 加载图片缓存
    let imgUrl = wx.getStorageSync('imgUrl')
    console.log(imgUrl);
    this.setData({
      imgUrl
    })
  },
})